package com.yuuzy.view;

import javax.swing.*;
import javax.swing.GroupLayout.Alignment;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

//系统主界面
public class MainInterface extends JFrame {

    private JPanel contentPane;
    private JDesktopPane table = null;

    /**
     * Create the frame.
     */
    public MainInterface() {
        setFont(new Font("Dialog", Font.PLAIN, 24));
        setTitle("金融管理系统主界面");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setBounds(100, 100, 2174, 1390);

        JMenuBar menuBar = new JMenuBar();
        setJMenuBar(menuBar);

        JMenu mnNewMenu = new JMenu("基本数据维护");
        mnNewMenu.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 20));
        mnNewMenu.setIcon(new ImageIcon(MainInterface.class.getResource("/image/tool.png")));
        menuBar.add(mnNewMenu);

        JMenu mnNewMenu_2 = new JMenu("客户维护  ");
        mnNewMenu_2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
        mnNewMenu_2.setIcon(new ImageIcon(MainInterface.class.getResource("/image/user (1).png")));
        mnNewMenu.add(mnNewMenu_2);

        JMenuItem menuItem_2 = new JMenuItem("客户管理   ");
        menuItem_2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                ManageClient manageclient = new ManageClient();
                manageclient.setVisible(true);
                table.add(manageclient);
            }
        });
        menuItem_2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
        mnNewMenu_2.add(menuItem_2);

        JMenuItem menuItem_3 = new JMenuItem("客户添加   ");
        menuItem_3.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                insertClientInterFrm insertclientinterfrm = new insertClientInterFrm();
                insertclientinterfrm.setVisible(true);
                table.add(insertclientinterfrm);
            }
        });
        menuItem_3.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
        mnNewMenu_2.add(menuItem_3);

        JMenu mnNewMenu_3 = new JMenu("产品维护");
        mnNewMenu_3.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
        mnNewMenu_3.setIcon(new ImageIcon(MainInterface.class.getResource("/image/产品.png")));
        mnNewMenu.add(mnNewMenu_3);

        JMenu menu_1 = new JMenu("产品管理");
        menu_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
        mnNewMenu_3.add(menu_1);

        JMenuItem mntmBxian = new JMenuItem("保险");
        mntmBxian.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                ManageInsurance manageinsurance = new ManageInsurance();
                manageinsurance.setVisible(true);
                table.add(manageinsurance);
            }
        });
        mntmBxian.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 14));
        menu_1.add(mntmBxian);

        JMenuItem menuItem_6 = new JMenuItem("基金");
        menuItem_6.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                ManageFund managefund = new ManageFund();
                managefund.setVisible(true);
                table.add(managefund);
            }
        });
        menuItem_6.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 14));
        menu_1.add(menuItem_6);

        JMenuItem menuItem_14 = new JMenuItem("理财产品");
        menuItem_14.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                ManageWip managewip = new ManageWip();
                managewip.setVisible(true);
                table.add(managewip);
            }
        });
        menuItem_14.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 14));
        menu_1.add(menuItem_14);

        JMenu menu_2 = new JMenu("产品添加");
        menu_2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
        mnNewMenu_3.add(menu_2);

        JMenuItem menuItem_7 = new JMenuItem("保险");
        menuItem_7.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                InsertInsurance insertinsurance = new InsertInsurance();
                insertinsurance.setVisible(true);
                table.add(insertinsurance);
            }
        });
        menuItem_7.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 14));
        menu_2.add(menuItem_7);

        JMenuItem menuItem_8 = new JMenuItem("基金");
        menuItem_8.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                InsertFund insertfund = new InsertFund();
                insertfund.setVisible(true);
                table.add(insertfund);
            }
        });
        menuItem_8.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 14));
        menu_2.add(menuItem_8);

        JMenuItem menuItem_9 = new JMenuItem("理财产品");
        menuItem_9.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                InsertWip insertwip = new InsertWip();
                insertwip.setVisible(true);
                table.add(insertwip);
            }
        });
        menuItem_9.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 14));
        menu_2.add(menuItem_9);

        //安全退出
        JMenuItem menuItem_1 = new JMenuItem("安全退出");
        menuItem_1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                int result = JOptionPane.showConfirmDialog(null, "是否退出系统？");
                System.out.println(result);
                if (result == 0) {
                    dispose();
                }
            }
        });

        JMenu menu = new JMenu("产品购买");
        menu.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
        menu.setIcon(new ImageIcon(MainInterface.class.getResource("/image/Buy.png")));
        mnNewMenu.add(menu);

        JMenu menu_3 = new JMenu("购买");
        menu.add(menu_3);

        JMenuItem menuItem_10 = new JMenuItem("保险");
        menuItem_10.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                BuyInsurance buyinsurance = new BuyInsurance();
                buyinsurance.setVisible(true);
                table.add(buyinsurance);
            }
        });
        menuItem_10.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
        menu_3.add(menuItem_10);

        JMenuItem menuItem_11 = new JMenuItem("基金");
        menuItem_11.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                BuyFund buyfund = new BuyFund();
                buyfund.setVisible(true);
                table.add(buyfund);
            }
        });
        menu_3.add(menuItem_11);

        JMenuItem menuItem_12 = new JMenuItem("理财产品");
        menuItem_12.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                BuyWip buywip = new BuyWip();
                buywip.setVisible(true);
                table.add(buywip);
            }
        });
        menu_3.add(menuItem_12);

        JMenu menu_4 = new JMenu("查看订单");
        menu.add(menu_4);

        JMenuItem menuItem_13 = new JMenuItem("保险");
        menuItem_13.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                VieworderInsurance vieworderinsurance = new VieworderInsurance();
                vieworderinsurance.setVisible(true);
                table.add(vieworderinsurance);
            }
        });
        menu_4.add(menuItem_13);

        JMenuItem menuItem_15 = new JMenuItem("基金");
        menuItem_15.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                VieworderFund vieworderfund = new VieworderFund();
                vieworderfund.setVisible(true);
                table.add(vieworderfund);
            }
        });
        menu_4.add(menuItem_15);

        JMenuItem menuItem_16 = new JMenuItem("理财产品");
        menuItem_16.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                VieworderWip vieworderwip = new VieworderWip();
                vieworderwip.setVisible(true);
                table.add(vieworderwip);
            }
        });
        menu_4.add(menuItem_16);
        menuItem_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
        menuItem_1.setIcon(new ImageIcon(MainInterface.class.getResource("/image/tuichu.png")));
        mnNewMenu.add(menuItem_1);

        JMenu mnNewMenu_1 = new JMenu("关于我们");
        mnNewMenu_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 20));
        mnNewMenu_1.setIcon(new ImageIcon(MainInterface.class.getResource("/image/favour.png")));
        menuBar.add(mnNewMenu_1);

        //内部窗口“我们的团队”
        JMenuItem menuItem = new JMenuItem("我们的团队");
        menuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                OurTeam ourteam = new OurTeam();
                ourteam.setVisible(true);
                table.add(ourteam);
            }
        });
        menuItem.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
        menuItem.setIcon(new ImageIcon(MainInterface.class.getResource("/image/team.png")));
        mnNewMenu_1.add(menuItem);
        contentPane = new JPanel();
        contentPane.setBackground(Color.WHITE);
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
        setContentPane(contentPane);

        table = new JDesktopPane();
        GroupLayout gl_contentPane = new GroupLayout(contentPane);
        gl_contentPane.setHorizontalGroup(
                gl_contentPane.createParallelGroup(Alignment.LEADING)
                        .addComponent(table, GroupLayout.DEFAULT_SIZE, 2142, Short.MAX_VALUE)
        );
        gl_contentPane.setVerticalGroup(
                gl_contentPane.createParallelGroup(Alignment.LEADING)
                        .addGroup(gl_contentPane.createSequentialGroup()
                                .addComponent(table, GroupLayout.PREFERRED_SIZE, 1294, GroupLayout.PREFERRED_SIZE)
                                .addContainerGap(83, Short.MAX_VALUE))
        );
        contentPane.setLayout(gl_contentPane);

        //设置主页面最大化
        this.setExtendedState(JFrame.MAXIMIZED_BOTH);
    }

    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    MainInterface frame = new MainInterface();
                    frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }
}

